import React, { useState,useEffect } from 'react'
import axios from "axios";
export default function App() {
    const [name, setName] = useState("liaziqiao");
    const rand1 = Math.floor(Math.random() * 999999 + 1);
    useEffect(()=>{
setName(name.substring(0,1).toUpperCase()+name.substring(1))
    },[name])
    //第一次执行一次，之后name更新也会执行一次
        return (
          <div>改变-{name}
          <button onClick={()=>{
            setName("Xiaohong")
          }}>点击</button>
          </div>
        )
} 


